<!DOCTYPE html>
<html>
<head>
    <title>E8NET</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <include file="./App/Admin/View/Include/css.html" />
    <link href="__PUBLIC__/Admin/css/lib/select2.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/form-showcase.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<body>
<include file="./App/Admin/View/Include/navbar.html" />
<include file="./App/Admin/View/Include/menu.html" />

<!-- main container -->
<div class="content">


    <div role="breadcrumb">
        <ol class="breadcrumb">
            <li><a href="{:U('Depart/index')}">学院管理</a> / </li>
            <li class="active">修改专业</li>
        </ol>
    </div>

    <div class="container-fluid">

        <div id="pad-wrapper" class="form-page">
            <div class="row-fluid form-wrapper">
                <!-- left column -->
                <div class="span6 column offset3">
                    <form id="sadmin-form" />
                    <input type="hidden" value="{$D.id}" name = "id" id = "zy_id">
                    <div class="field-box">
                        <label>学院名称:</label>
                        <select style="width:250px" class="select2" id="xy_id"  placeholder="请选择学院名称">
                            <foreach name= "DepartList" item = "depart" >

                                <!--/**模板报错，加载缓存文件：初步判断与php版本或者TP版本有关**/-->
                                <if condition="$depart.id eq $D['f_id']">
                                    <option value="{$depart.id}" selected="selected">{$depart.name}</option>
                                    <else />
                                    <option value="{$depart.id}" >{$depart.name}</option>
                                </if>
                            </foreach>
                        </select>
                    </div>

                    <div class="field-box">
                        <label>专业名称</label>
                        <input class="span8 inline-input" id = "zy_name" name="name" placeholder="请输入专业名称" type="text" value="{$D.name}"/>
                        <br>
                        <span id="msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>


                    <div class="span6 field-box actions" style="padding-left:360px;">

                        <a href="javascript:edit();" class="btn-flat default">
                            提交表单
                        </a>
                        <a href="{:U('index')}" class="btn-flat gray">
                            放弃提交
                        </a>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end main container -->

<include file="./App/Admin/View/Include/js.html" />
<script src="__PUBLIC__/Admin/js/jquery-latest.js"></script>
<script src="__PUBLIC__/Admin/js/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.uniform.min.js"></script>
<script src="__PUBLIC__/Admin/js/select2.min.js"></script>

<script type="text/javascript">



    function edit() {
        var id = $('#zy_id').val();
        var f_id=$('#xy_id').val();
        var name = $('#zy_name').val();
        if ( name == ""){
            $('#msg >small').html('专业名称不能为空!');
            $('#msg').show();
            return;
        }
        $.post('__APP__/Depart/edit_zy',{id:id,name:name,f_id:f_id}, function (result) {
            var obj = eval('('+result+')');
            if (obj.result == "RESULT_OK"){
                window.location.href = obj.data;
            }else{
                $('#msg > small').html(obj.msg);
                $('#msg').show();
            }

        });

    }
</script>


</body>
</html>